import java.util.StringTokenizer;

class P11494_39643 {

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuilder buffer = new StringBuilder();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString());
	}

	public static void main(String[] args) {
		
		while (true) {
			StringTokenizer st = new StringTokenizer(readLn());
			int x1 = Integer.parseInt(st.nextToken());
			int y1 = Integer.parseInt(st.nextToken());
			int x2 = Integer.parseInt(st.nextToken());
			int y2 = Integer.parseInt(st.nextToken());
		
			if (x1 == 0 && x1 == y1 && y1 == x2 && x2 == y2) break;
			
			if (x1 == x2 && y1 == y2) System.out.println("0");
			else {
				int xmin = Math.min(x1, x2);
				int xmax = Math.max(x1, x2);
				int ymin = Math.min(y1, y2);
				int ymax = Math.max(y1, y2);
				
				int dx = xmax - xmin;
				int dy = ymax - ymin;
				
				if ((x1 == x2 || y1 == y2) || (dx == dy)) System.out.println("1");
				else System.out.println("2");
				
			}
			
		}
		
	}

}
